
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <title>Params Module User’s Guide &#8212; Texas A&amp;M Oil spill / Outfall Calculator 2.1.0 documentation</title>
    <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script src="../_static/jquery.js"></script>
    <script src="../_static/underscore.js"></script>
    <script src="../_static/doctools.js"></script>
    <script src="../_static/language_data.js"></script>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="scales" href="../scripts/params/scales.html" />
    <link rel="prev" title="blowout_jet" href="../scripts/psm/blowout_jet.html" />
   
  <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head><body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          

          <div class="body" role="main">
            
  <div class="section" id="params-module-user-s-guide">
<h1>Params Module User’s Guide<a class="headerlink" href="#params-module-user-s-guide" title="Permalink to this headline">¶</a></h1>
<dl class="field-list simple">
<dt class="field-odd">Release</dt>
<dd class="field-odd"><p>2.1</p>
</dd>
<dt class="field-even">Date</dt>
<dd class="field-even"><p>Jun 05, 2020</p>
</dd>
</dl>
<div class="section" id="scripts">
<h2>Scripts<a class="headerlink" href="#scripts" title="Permalink to this headline">¶</a></h2>
<p>The object and methods defined in the <cite>params</cite> module stores the parameters
defining a plume model simulation, computes the governing dimensional
parameters, and computes the characteristic length and velocity scales using
empirical formulas from Socolofsky and Adams (2002 and 2005).</p>
<p>The example detailed below demonstrates how to interact with the object and
methods defined in the <cite>params</cite> module. Further examples are presented in the
following script distributed in the <code class="docutils literal notranslate"><span class="pre">./bin/params</span></code> directory with the
source code.</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../scripts/params/scales.html">scales</a></li>
</ul>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<p>This example illustrates the tasks necessary to setup the <cite>params.Scales</cite>
object and use its internal methods.  The basic purpose of this method is
to predict the characteristic scales of a plume model solution.  As a
result, setting up the <cite>params.Scales</cite> object requires many of the same
tasks as setting up the <cite>stratified_plume_model</cite>.  For instance, we need
to read in ambient CTD data and create a list of dispersed phase
<cite>stratified_plume_model.Particle</cite> objects.  For more details on the data
needed to run the plume models, see the examples in the <a class="reference internal" href="spm.html"><span class="doc">Stratified Plume Model User’s Guide</span></a>.</p>
<p>Before running the examples here, be sure to install the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> package and
run all of the tests in the <code class="docutils literal notranslate"><span class="pre">./test</span></code> directory. The commands below should be
executed in an IPython session. Start IPython by executing:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ipython</span> <span class="o">--</span><span class="n">pylab</span>
</pre></div>
</div>
<p>at the command prompt.</p>
<p>Import the <code class="docutils literal notranslate"><span class="pre">TAMOC</span></code> modules that will be needed for this example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">tamoc</span> <span class="kn">import</span> <span class="n">ambient</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">tamoc</span> <span class="kn">import</span> <span class="n">dbm</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">tamoc</span> <span class="kn">import</span> <span class="n">stratified_plume_model</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">tamoc</span> <span class="kn">import</span> <span class="n">params</span>
</pre></div>
</div>
<p>To compute the “<em>in situ</em>” properties of the dispersed phase particles, we
need to have ambient CTD data:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">profile</span> <span class="o">=</span> <span class="n">ambient</span><span class="o">.</span><span class="n">Profile</span><span class="p">(</span><span class="s1">&#39;../test/output/test_BM54.nc&#39;</span><span class="p">,</span> <span class="n">chem_names</span><span class="o">=</span><span class="s1">&#39;all&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The next step is to select a release depth and temperature for the plume
origin:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">z0</span> <span class="o">=</span> <span class="mf">1000.</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">T0</span> <span class="o">=</span> <span class="mf">273.15</span> <span class="o">+</span> <span class="mf">35.</span>
</pre></div>
</div>
<p>For this example, we will consider a pure gas release with the following
properties:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">composition</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;methane&#39;</span><span class="p">,</span> <span class="s1">&#39;ethane&#39;</span><span class="p">,</span> <span class="s1">&#39;propane&#39;</span><span class="p">,</span> <span class="s1">&#39;oxygen&#39;</span><span class="p">]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">yk</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">0.93</span><span class="p">,</span> <span class="mf">0.05</span><span class="p">,</span> <span class="mf">0.02</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">gas</span> <span class="o">=</span> <span class="n">dbm</span><span class="o">.</span><span class="n">FluidParticle</span><span class="p">(</span><span class="n">composition</span><span class="p">)</span>
</pre></div>
</div>
<p>We use this gas to define a list of dispersed phase particles for the release.
In this example, we will consider one particle size class. the <cite>scales</cite> script
listed above demonstrates how to include multiple particles in the
simulation:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">disp_phases</span> <span class="o">=</span> <span class="p">[]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mb0</span> <span class="o">=</span> <span class="mf">8.0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">de</span> <span class="o">=</span> <span class="mf">0.01</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lambda_1</span> <span class="o">=</span> <span class="mf">0.85</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">disp_phases</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">stratified_plume_model</span><span class="o">.</span><span class="n">particle_from_mb0</span><span class="p">(</span><span class="n">profile</span><span class="p">,</span> <span class="n">z0</span><span class="p">,</span> <span class="n">gas</span><span class="p">,</span> <span class="n">yk</span><span class="p">,</span> <span class="n">mb0</span><span class="p">,</span> <span class="n">de</span><span class="p">,</span> <span class="n">lambda_1</span><span class="p">,</span> <span class="n">T0</span><span class="p">))</span>
</pre></div>
</div>
<p>The inputs are now collected to create the <cite>params.Scales</cite> object:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">model</span> <span class="o">=</span> <span class="n">params</span><span class="o">.</span><span class="n">Scales</span><span class="p">(</span><span class="n">profile</span><span class="p">,</span> <span class="n">disp_phases</span><span class="p">)</span>
</pre></div>
</div>
<p>The <cite>params.Scales</cite> object performs two basic functions.  The first job of
the object is to compute the key independent variables describing the plume
simulation.  This is accomplished by the <cite>params.get_variables</cite> method.  This
method is used by all the other internal methods, and would not normally be
called by the user.  However, its functionality is demonstrated here:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="p">(</span><span class="n">B</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">us</span><span class="p">,</span> <span class="n">ua</span><span class="p">)</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">get_variables</span><span class="p">(</span><span class="n">z0</span><span class="p">,</span> <span class="mf">0.15</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">B</span>
<span class="go">0.85410643976609724</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">N</span>
<span class="go">0.001724100901081246</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">us</span>
<span class="go">0.22404202921415406</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ua</span>
<span class="go">0.15</span>
</pre></div>
</div>
<p>The second, and more important, role of the <cite>params.Scales</cite> object is to
compute the characteristic scales of a given simulation setup.  For the
geometric scales, this is achieved as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">h_T</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">h_T</span><span class="p">(</span><span class="n">z0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h_T</span>
<span class="go">329.25679149878414</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h_P</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">h_P</span><span class="p">(</span><span class="n">z0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h_P</span>
<span class="go">566.48866125997949</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h_S</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">h_S</span><span class="p">(</span><span class="n">z0</span><span class="p">,</span> <span class="mf">0.15</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">h_S</span>
<span class="go">544.7860341109531</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lambda_1</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">lambda_1</span><span class="p">(</span><span class="n">z0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">lambda_1</span>
<span class="go">0.79378359736452342</span>
</pre></div>
</div>
<p>For the velocity scale, there are three choices:  the ambient current (
chosen by the user), the slip velocity of the bubbles (computed by the
<cite>get_variables</cite> method above), or the critical crossflow velocity, defined
as the velocity at which <code class="docutils literal notranslate"><span class="pre">h_S</span> <span class="pre">=</span> <span class="pre">h_P</span></code>.  This is computed as follows:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">ua_crit</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">u_inf_crit</span><span class="p">(</span><span class="n">z0</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">ua_crit</span>
<span class="go">0.14348700121799565</span>
</pre></div>
</div>
</div>
</div>


          </div>
          
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="../index.html">Texas A&M Oil spill / Outfall Calculator</a></h1>








<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../user_manual.html">TAMOC User Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../unit_tests.html">Unit Tests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs</a></li>
<li class="toctree-l1"><a class="reference internal" href="../readme.html">Read Me File</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release.html">Release Notes</a></li>
<li class="toctree-l1"><a class="reference internal" href="../license.html">License</a></li>
</ul>

<div class="relations">
<h3>Related Topics</h3>
<ul>
  <li><a href="../index.html">Documentation overview</a><ul>
  <li><a href="../user_manual.html">TAMOC User Manual</a><ul>
      <li>Previous: <a href="../scripts/psm/blowout_jet.html" title="previous chapter">blowout_jet</a></li>
      <li>Next: <a href="../scripts/params/scales.html" title="next chapter">scales</a></li>
  </ul></li>
  </ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>








        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2020, Scott A. Socolofsky.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.4</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
      
      |
      <a href="../_sources/guides/params.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>